<% extend 'shared/admin-base' %>
<% block 'head': %>
<link rel="stylesheet" href="/dist/admin-goodstype.css">
<% end %>

<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            类别管理
            <small></small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="/adminer/index">首页</a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li class="btn-group">
                <ul class="pull-right">
                    <a href="#addmodal" data-toggle="modal" class="btn green"><i class="fa fa-plus"></i> 添加</a>

                </ul>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>

<div class="alert alert-sm alert-info alert-dismissible ">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    当类别之下包含有商品，是不允许删除的，删除是无效的。
</div>

<div class="row">

    <% for type in @types : %>

    <div class="col-md-6 col-sm-6">
        <div class="portlet box blue">
            <div class="portlet-title">
                <div class="caption"><i class="fa fa-calendar"></i><%= type.dataValues.title %></div>

                <div class="tools">
                    <a href="" class="collapse"></a>
                    <a href="" data="<%= type.dataValues.id %>" count="<%= type.dataValues.GoodsTypes.length %>"
                       class="remove"></a>
                </div>
                <div class="actions">
                    <a href="#addmodal2" data-toggle="modal" data="<%= type.dataValues.id %>" class="btn add2 green"><i
                            class="fa fa-plus"></i> 添加</a>
                    <a href="#editmodal" data-toggle="modal" data="<%= type.dataValues.id %>"
                       value="<%= type.dataValues.title %>" class="btn edit1 yellow"><i class="fa fa-edit"></i> 修改</a>
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-responsive">

                    <% for type2 in type.dataValues.GoodsTypes : %>
                    <div style="height: 30px">
                        <span class="title2"><%= type2.title %></span>
                        <button data="<%= type2.id %>" class="btn red btn-sm del del2 remove">删除</button>
                        <a href="#editmodal2" data="<%= type2.id %>" value="<%= type2.title %>" data-toggle="modal"
                           class="btn default btn-sm edit2 edit"><i class="fa fa-edit"></i> 修改</a>

                    </div>
                    <hr>

                    <% end %>

                </div>
            </div>
        </div>
    </div>

    <% end %>
</div>


<div id="addmodal" class="modal fade" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">添加</h4>
            </div>
            <div class="modal-body" style="height: 150px !important">

                <div class="row">
                    <div class="col-md-12">
                        <h4>标题</h4>
                        <p><input id="add1" type="text" class="col-md-12 form-control"></p>
                    </div>

                </div>

            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn default">关闭</button>
                <button type="button" id="add1btn" class="btn green">保存</button>
            </div>
        </div>
    </div>
</div>

<div id="editmodal" class="modal fade" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">修改</h4>
            </div>
            <div class="modal-body" style="height: 150px !important">

                <div class="row">
                    <div class="col-md-12">
                        <h4>标题</h4>
                        <p><input id="edit1" type="text" class="col-md-12 form-control"></p>
                        <input id="editid" value="" type="hidden">
                    </div>

                </div>

            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn default">关闭</button>
                <button type="button" id="edit1btn" class="btn green">保存</button>
            </div>
        </div>
    </div>
</div>

<div id="addmodal2" class="modal fade" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">添加</h4>
            </div>
            <div class="modal-body" style="height: 150px !important">

                <div class="row">
                    <div class="col-md-12">
                        <h4>标题</h4>
                        <p><input id="add2" type="text" class="col-md-12 form-control"></p>
                        <input id="add2fid" value="" type="hidden">
                    </div>

                </div>

            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn default">关闭</button>
                <button type="button" id="add2btn" class="btn green">保存</button>
            </div>
        </div>
    </div>
</div>

<div id="editmodal2" class="modal fade" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">修改</h4>
            </div>
            <div class="modal-body" style="height: 150px !important">

                <div class="row">
                    <div class="col-md-12">
                        <h4>标题</h4>
                        <p><input id="edit2" type="text" class="col-md-12 form-control"></p>
                        <input id="edit2id" value="" type="hidden">
                    </div>

                </div>

            </div>
            <div class="modal-footer">
                <button type="button" data-dismiss="modal" class="btn default">关闭</button>
                <button type="button" id="edit2btn" class="btn green">保存</button>
            </div>
        </div>
    </div>
</div>


<% block 'scripts': %>
<script src="/dist/admin-goodstype.js"></script>
<% end %>


